﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DeployGames.TweenEngine.TestBed.acessors
{
    public class TextboxAcessor : IBaseTweenAcessor
    {
        public const int X = 0;
        public const int Y = 1;
        public const int XY = 2;

        public int getValues(IBaseAcessor target, int tweenType, float[] returnValues)
        {
            AcessorTextBox txt = (target as AcessorTextBox);
            switch (tweenType)
            {
                case X:
                    returnValues[0] = txt.Location.X;
                    return 1;
                case Y:
                    returnValues[0] = txt.Location.Y;
                    return 1;
                case XY:
                    returnValues[0] = txt.Location.X;
                    returnValues[1] = txt.Location.Y;
                    return 2;
            }
            return 0;
        }

        public void setValues(IBaseAcessor target, int tweenType, float[] newValues)
        {
            AcessorTextBox txt = (target as AcessorTextBox);
            switch (tweenType)
            {
                case X:
                    txt.Location = new System.Drawing.Point((int)newValues[0], txt.Location.Y);
                    break;
                case Y:
                    txt.Location = new System.Drawing.Point(txt.Location.X, (int)newValues[0]);
                    break;
                case XY:
                    txt.Location = new System.Drawing.Point((int)newValues[0], (int)newValues[1]);
                    break;
            }
        }
    }
}
